<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
pageContext.setAttribute("needSound", true);
pageContext.setAttribute("ctx", path);
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<script type="text/javascript" src="${ctx}/static/js/lib/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="${ctx}/static/js/lib/jquery.cookie.js"></script>
<bgsound id="bgsound" loop="infinite" autostart="true">
<script type="text/javascript">
  var needSound = $.cookie("needSound");
  if(needSound!='false'){
	  document.getElementById("bgsound").src="${ctx}/static/sound/alert.mp3";
  }
  function openSound(){
	  $.cookie("needSound",null);
  }
  function closeSound(){
	  var dayToColse = 1;//一天
	  $.cookie("needSound", "false", {expires:dayToColse});
	  document.getElementById("bgsound").src="";
  }
</script>
<html>
  <body>
   <bgsound id="bgsound" loop="infinite" autostart="true">
   <input type="button" onclick="openSound()" value="打开背景音"/>
   <input type="button" onclick="closeSound()" value="关闭背景音"/>
  </body>
</html>
